<template>
	<div>
		<NoticeBar v-if="state.noticeStr" :text="state.noticeStr" leftIcon="basefont icon-tongzhi" background="#ecf5ff" color="#409eff" />
		<personalUserPage/>
		<myMenuPage/>
		<myToDoListPage/>
	</div>
</template>

<script lang="ts" setup name="commonHomePage">
// 引入组件
const NoticeBar = defineAsyncComponent(() => import('@/components/noticeBar/index.vue')); //滚动通知组件
const personalUserPage = defineAsyncComponent(() => import('@/views/overview/component/personal/indexUser.vue')); //个人信息
const myMenuPage = defineAsyncComponent(() => import('@/views/overview/component/myMenu/index.vue')); //常用菜单
const myToDoListPage = defineAsyncComponent(() => import('@/views/overview/component/work/myTodoList.vue')); //我的待办
//------------------接收传入参数(组件)-------------------

//------------------定义子组件---------------------------
const VITE_APP_ID = import.meta.env.VITE_APP_ID as string;
//------------------内部变量定义-------------------------
const state = reactive({
	noticeList: [],
	noticeStr: '欢迎使用本系统！',
});
//------------------定义调用方法-------------------------
const getNoticeList = () => {
	//获取系统状态通知
	let params: any = { appId: VITE_APP_ID,userType: $store.user.userType};
	$api.common.send.post('sysNotice0011', params).then((res: any) => {
		state.noticeList = res.result;
		if (res.result && res.result.length > 0) {
			let str = '';
			res.result.forEach((element) => {
				if (str) {
					str = str + ',' + element.title;
				} else {
					str = element.title;
				}
			});
			state.noticeStr = str;
		}
	});
};
//-------------------------初始化-----------------------------
onMounted(() => {
	nextTick(() => {
		getNoticeList();
	});
});
</script>
<style scoped lang="scss"></style>